Cleaning up the Black Hat Bash environment, this may take a few moments...
OK: lab environment has been destroyed.
Listing 3-1
Lab cleanup command output
After running the command, you should receive a confirmation that the lab
environment has been destroyed.
Rebuilding
When we execute a rebuild, the lab will first shut down all running containers,
delete volumes, and remove all container images before running a new
deployment. To execute the rebuild, run the following command:
$ ./run.sh rebuild
If you rebuild the lab, you’ll lose any data you saved inside of your containers.
Rebuilding is useful when something goes wrong during installation. Maybe, half-
way through it, you lost your network connection, and it reported a failed state.
The rebuild command allows you to wipe and install it from scratch.
Accessing Individual Lab Machines
As you progress through the book, you’ll compromise the machines in the lab
environment. However, it often takes multiple attempts to obtain full access to a
machine. Sometimes, you may need to troubleshoot an issue or reproduce a post-
compromise activity, and you won’t want to repeat the steps you performed to
obtain access.
To gain shell access to any individual lab machine, you can run the following
Docker command:
$ docker exec -it MACHINE-NAME bash
MACHINE-NAME represents the name of a lab machine, such as p-web-01 or
p-jumpstation-01 (or any other machine from Table 3-1 that starts with p- or c-).
The Docker command will drop you into a bash shell, at which point you can
execute any command you like. To exit, simply enter exit in the prompt or close
the terminal session’s window.
We highly recommend you compromise the machines as intended before
taking these convenient shortcuts, however.
Installing Additional Hacking Tools
Most of the tools we’ll use in this book will come pre-installed in Kali, and
we’ll introduce them upon first use. However, we’ll need several tools that aren’t
installed by default, so let’s install them here. First, create a new directory in
which to place your tools:
$ cd ~
Black Hat Bash (Early Access) © 2023 by Dolev Farhi and Nick Aleks